package com.zzptc.liudong.exam;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.zzptc.liudong.util.MyUtil;

import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Timer timer=new Timer();
        SharedPreferences sharedPreferences= MyUtil.getSharedPre();
        boolean bool=sharedPreferences.getBoolean("wel",false);
        if(bool){
            TimerTask task=new TimerTask(){
                public void run(){
                    Intent intent = new Intent(MainActivity.this,Main2Activity.class);
                    startActivity(intent);
                }
            };
            timer.schedule(task,1000);
        }else{
            TimerTask task=new TimerTask(){
                public void run(){
                    startActivity(new Intent(MainActivity.this,Main3Activity.class));
                }
            };
            timer.schedule(task,3000);
        }
        finish();

    }
    }

